﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>微信提现列表-微街秀管理后台</title>
    <link href="../../Client/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="../css/admin.css" rel="stylesheet" type="text/css" />
    <style>
        /*分页*/
        .pager_style{width: 100%;height: 30px;margin-top: 10px;text-align: left;color: #909090;}
        .pager_style li{font-size: 14px;}
        .pager_style .page_num{height: 100%;font-size: 0;display: inline-block;float: left;}
        .pager_style .page_num li{height: 100%;border: 1px solid #eeeeee;padding: 0 10px;margin-right: 5px;line-height: 30px;display: inline-block;cursor: pointer;float: left;}
        .pager_style .page_num li:hover{border: 1px solid #f37b0b;background-color: #f37b0b;color: White;}
        /*分页 选中当页样式*/
        .pager_style .page_num .active{border: 1px solid #f37b0b;background-color: #f37b0b;color: White;cursor: default;}
        /*分页 不可用样式*/
        .pager_style .page_num .disable{background-color: #f1f1f1;}
        .pager_style .page_num .disable:hover{border: 1px solid #eeeeee;background-color: #f1f1f1;color: #909090;}
        .pager_style .page_info{display: inline-block;float: left;}
        .pager_style .page_info li{display: inline-block;margin-left: 10px;float: left;line-height: 30px;}
        table{border-collapse: collapse;border: none;width: 980px;text-align: center;}
        td{border: solid #ccc 1px;color: Black;height: 26px;padding:5px 0 2px 0;}
        td a{text-decoration: none;}
        td img{ margin-bottom:3px;}
        .td1, .td2, .td3, .td6{width: 100px;font-weight: bold;text-align: center;font-size: 13px;}
        .td4, .td5{width: 250px;font-weight: bold;text-align: center;}
    </style>
    <script src="../js/jquery-1.9.1.min.js" type="text/javascript"></script>
    <script src="../js/base.js" type="text/javascript"></script>
    <script src="../js/ajax-data.js" type="text/javascript"></script>
    <script src="../js/Pager.js" type="text/javascript"></script>
    <script src="../js/dialog.js" type="text/javascript"></script>
    <script src="../js/DatePicker/zh-cn/WdatePicker.js" type="text/javascript"></script>
</head>
<body class="mainbody">
    <div class="navigation"><a href="javascript:" class="back">后退</a>首页 &gt; 交易管理 &gt; <span class="headtitle">微信提现审核</span></div>
    <hr style="margin-top:0px;" />
      
    <div style="width: 980px; margin-left: auto; margin-right: auto;">
        <div style="height:30px;">
            会员编号:<input type="text" id="userid" name="userid" style="width: 80px;" />
            状态:<select id="state" name="state" style="width: 80px;">
                <option value="-1">不限</option>
                <option value="0">待审核</option>
                <option value="1">已审核</option>
                <option value="2">已拒绝</option>
            </select>
            <span id="s_platform" style="display:none;">提现平台:<select id="platform" name="platform" style="width: 80px;">
                <option value="-1">不限</option>
                <option value="1">微信</option>
                <option value="2">支付宝</option>
            </select></span>
            <span >
                商户ID:<select id="mchid" name="mchid" style="width: 80px;">
                    <option value="">不限</option>
                    <option value="1299910501">1299910501移动APP</option>
                    <option value="1299894401">1299894401网页版</option>
                </select>
            </span>
            时间段:<input type="text" id="starttime" name="starttime" style="width: 80px;" onclick="WdatePicker()"/>
            至:<input type="text" id="endtime" name="endtime" style="width: 80px;"onclick="WdatePicker()"/>
            <input type="button" id="btn" value="搜 索" onclick="submits()" /></div>
     <div class="tab_con" style="display:block;">
        <table >
        <tr><td style='width:60px;'>会员编号</td>
        <td class='td1'>订单号</td>
        <td class='td1'>姓名</td>
        <td class='td1' style='width:120px;'>微信昵称</td>
        <td class='td2' style='width:70px;'>提现金额</td>
        <td class='td2' style='width:70px;'>手机验证</td>
        <td class='td3'>提现状态</td>
        <td class='td3' style='width:50px;'>平台</td>
        <td class='td6' style='width:170px;'>审核</td>
        <td class='td3' style='width:160px;'>申请时间</td>
        <td style='width:80px;'>操作</td>
        </tr>
        <tbody id="list"></tbody>
        </table>
        <button onclick="alipayTx();" style="display:none">
            支付宝批量提现</button>
        <div style="margin-top:10px;">
            提现审核条件：<br />
            1、订单号、微信昵称、提现金额不能为空；<br>
            2、状态必须是 “未审核”才允许提现；
        </div>
        <div class="pager_style">
            <ul class="page_num">
            </ul>
            <ul class="page_info">
                <li>总数:<span id="count">0</span></li>
                <li>每页:<span id="pageSize">0</span></li>
                <li>页数:<span id="pageToal">0</span></li>
            </ul>
        </div>
        </div>
        <input type="hidden" id="pagecount" value="0" />
    </div>
    <script>
        var pager = new Pager();
        $(function () {
            islogin();
            var sel = document.getElementById("state");
            for (var i = 0; i < sel.options.length; i++) {
                if (sel.options[i].value == getUrlArgStr("state"))
                    sel.selectedIndex = i;
            }
            var sel2 = document.getElementById("platform");
            for (var i = 0; i < sel2.options.length; i++) {
                if (sel2.options[i].value == getUrlArgStr("platform"))
                    sel2.selectedIndex = i;
            }

            if (getQueryString("state") == "1")
                $(".headtitle").html("已审核列表");
            else if (getQueryString("state") == "2")
                $(".headtitle").html("已拒绝列表");

            if (getQueryString("state") != "0")
                $("#s_platform").css("display", "");
            $(".l-selected a", window.parent.document).html($(".headtitle").html())    //tab的标题
            GetList(1);
        });

        function GetList(page) {
            var sel2 = document.getElementById("platform");
            for (var i = 0; i < sel2.options.length; i++) {
                if (sel2.options[i].value == getUrlArgStr("platform"))
                    sel2.selectedIndex = i;
            }

            var param = "page_index=" + page + "&userid=" + $("#userid").val() + "&state=" + $("#state").val() + "&platform=" + $("#platform").val() + "&starttime=" + $("#starttime").val() + "&endtime=" + $("#endtime").val() + "&mchid=" + $("#mchid").val();
        
            var html = "";
            $("#list").html(html);
            AjaxStart("../ajax/fc_cash.ashx?getlist", param, function (data) {
                if (data.code != 0) {
                    $("#list").html(html + "<tr><td colspan='11'>" + data.msg + "</td></tr>");
                }
                else {
                    $("#list").html("");
                    var list = data.item.table;
                    for (var i = 0; i < list.length; i++) {
                        var platform = "";
                        var mchid = list[i].wx_mchid;
                        if (list[i].platform == 1) platform = "微信(商户ID:"+mchid+")";
                        else if (list[i].platform == 2) platform = "支付宝";

                        var state = "";
                        if (list[i].state == 0)
                            state = "待审核";
                        else if (list[i].state == 1)
                            state = "<span style='color:green;'>已审核</span>";
                        else if (list[i].state == 2)
                            state = "<span style='color:red;'>已拒绝</span>";

                        //详细页链接
                        var a_href = "";
                        if (list[i].record_id > 0)
                            a_href = "../fc_record/detail_ad.html?userid=" + list[i].user_id + "&amount=" + list[i].amount;
                        else
                            a_href = "../fc_record/detail_shared.html?userid=" + list[i].user_id + "&amount=" + list[i].amount;

                        html += "<tr id='tr" + list[i].id + "'>";
                        html += "<td>" + list[i].user_id + "</td>";
                        html += "<td>" + list[i].orderid + "</td>";
                        html += "<td>" + (list[i].name == null ? "" : list[i].name) + "</td>";
                        html += "<td><a href='" + list[i].logo + "' target=\"_blank\"><img src='" + list[i].logo + "' style='height:40px;'><br/>" + list[i].nickname + "</td>";
                        html += "<td style='text-align:right;padding-right:5px;'><a href='" + a_href + "'>" + list[i].amount + "元</a></td>";
                        html += "<td>" + (list[i].is_validate_phone == 1 ? "已验证" : "未验证") + "</td>";
                        html += "<td>" + state + "</td>";
                        html += "<td>" + platform + "</td>";
                        html += "<td style='text-align:left;'>审核人:" + (list[i].check_adminid < 1 ? "" : list[i].check_adminid) + "<br>时间:" +
                         (list[i].check_date == null ? "" : list[i].check_date.replace("T", " ").substring(0, 19)) + "</td>";

                        html += "<td>" + list[i].date.replace("T", " ").substring(0, 19) + "</td>";

                        var a = "";
                        if (list[i].platform == 2)
                            a = "<a href='ali_tixian.html?ids=" + list[i].id + "' target=\"_blank\">通过</a>";
                        else
                            a = "<a href='javascript:' onclick='check(1," + list[i].id + ")'>通过</a>";

                        var cancel = "<a href='javascript:' onclick='check(3," + list[i].id + ")'>撤销</a>";
                        if (list[i].state == 1)
                            html += "<td><span  style='color:#ccc;'>通过</span> | <a href='javascript:' onclick=\"check(2," + list[i].id + ")\">拒绝</a></td>";
                        else if (list[i].state == 2)
                            html += "<td>" + a + " | <span  style='color:#ccc;'>拒绝</span></td>";
                        else
                            html += "<td>" + a + " | <a href='javascript:' onclick=\"check(2," + list[i].id + ")\">拒绝</a><br/><br/>" + cancel + "</td>";
                        html += "</tr>";
                    }
                    $("#list").html(html);
                }
                pager.initPage(page, data.item.itemCount, 20, 5, GetList);
            });
        }

        function submits() {
            islogin();
            GetList(1);
        }

        //提现审核
        function check(type, id) {
            var msg = ""; //拒绝理由
            var param = "type=" + type + "&id=" + id;

            if (type == 3) {
                if (!confirm("撤销后，钱会退回到账号,确定吗？"))
                    return false;
            }
            AjaxStart("../ajax/fc_cash.ashx?check", param, function (data) {
                if (data.code != 0)
                    Alert(data.msg);
                else {
                    Alert("操作成功");
                    $("#tr" + id).css("display", "none");
                }
            });

        }

        //支付宝批量付款
        function alipayTx() {
            var ids = "";
            $("input[name = 'alipayOrders']").each(function () {
                if ($(this).is(':checked')) {
                    ids += "," + $(this).val();
                }
            });
            if (ids.length < 1) {
                alert("请选中要提现的订单!");
                return;
            }
            window.open("ali_tixian.html?ids=" + ids.substring(1));
        }

        function SelectAll(obj) {
            var chk = document.getElementsByName("alipayOrders");
            for (var i = 0; i < chk.length; i++)
                chk[i].checked = obj.checked;
        }

    </script>
</body>
</html>
